//
//  TransferChoosePublishTableViewController.swift
//  甜言蜜语
//
//  Created by 王剑伟 on 16/7/18.
//  Copyright © 2016年 wl. All rights reserved.
//

import UIKit

class TransferChoosePublishTableViewController: UIViewController, UIAlertViewDelegate {
    @IBOutlet weak var shopView: UILabel!
    @IBOutlet weak var goodsView: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.shopView.backgroundColor = UIColor.colorWithRGB(211, g: 213, b: 213)
        
    }
    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        self.tabBarController?.tabBar.hidden = true
    }
    @IBAction func shop(sender: UIButton) {
        if !ApplicationDelegate.isLogin(){
            let sb = UIStoryboard(name: "Login", bundle: nil)
            let vc = sb.instantiateViewControllerWithIdentifier("LoginViewController")
            self.navigationController?.pushViewController(vc, animated: true)
            
        } else if NSUserDefaults.standardUserDefaults().boolForKey("k_UD_isComplete") {
            
            let type = NSUserDefaults.standardUserDefaults().objectForKey("k_UD_type") as! String
            
            if type == "美容院" || type == "企业" {
                self.shopView.backgroundColor = UIColor.colorWithRGB(211, g: 213, b: 213)
                self.goodsView.backgroundColor = UIColor.whiteColor()
                let vc = self.storyboard?.instantiateViewControllerWithIdentifier("TransferPublishShopTableViewController")
                
                self.navigationController?.pushViewController(vc!, animated: true)
            } else {

            let alertView = UIAlertView(title: "提示", message: "您所注册的会员类别不能发布转让信息", delegate: self, cancelButtonTitle: "确定")
            
            alertView.show()
            }
        } else {
            let alertView = UIAlertView(title: "提示", message: "请完成注册", delegate: self, cancelButtonTitle: "确定")
            
            alertView.show()
            
        }
    }
    
    @IBAction func goods(sender: UIButton){
        if !ApplicationDelegate.isLogin(){
            let sb = UIStoryboard(name: "Login", bundle: nil)
            let vc = sb.instantiateViewControllerWithIdentifier("LoginViewController")
            self.navigationController?.pushViewController(vc, animated: true)
            
        } else if NSUserDefaults.standardUserDefaults().boolForKey("k_UD_isComplete") {
            
            let type = NSUserDefaults.standardUserDefaults().objectForKey("k_UD_type") as! String
           
            if type == "美容院" || type == "企业" {
                self.shopView.backgroundColor = UIColor.whiteColor()
                self.goodsView.backgroundColor = UIColor.colorWithRGB(211, g: 213, b: 213)
                
                let vc = self.storyboard?.instantiateViewControllerWithIdentifier("TransferPublishGoodsTableViewController")
                self.navigationController?.pushViewController(vc!, animated: true)
            }else {
            
                 let alertView = UIAlertView(title: "提示", message: "您所注册的会员类别不能发布转让信息", delegate: self, cancelButtonTitle: "确定" )
            
                 alertView.show()
            }
            
        }else {
                let alertView = UIAlertView(title: "提示", message: "请完成注册信息", delegate: self, cancelButtonTitle: "确定" )
                
                alertView.show()
            }

    }

    
}
